import { Module } from '@nestjs/common';
import { Aaa7Service } from './aaa7.service';
import { Aaa7Controller } from './aaa7.controller';
import * as nodemailer from 'nodemailer';
const Imap = require('imap');

@Module({
  controllers: [Aaa7Controller],
  providers: [
    Aaa7Service,
    {
      provide: 'MAIL_TRANSPORTER',
      useFactory(...args) {
        const transporter = nodemailer.createTransport({
          host: 'smtp.qq.com',
          port: 587,
          secure: false,
          auth: {
            user: '2313517435@qq.com',
            pass: 'ludluzimxuspebha',
          },
        });
        return transporter;
      },
    },
    {
      provide: 'IMAP',
      useFactory(...args) {
        const imap = new Imap({
          user: '2313517435@qq.com',
          password: 'ludluzimxuspebha',
          host: 'imap.qq.com',
          port: 993,
          tls: true,
        });
        return imap;
      },
    },
  ],
})
export class Aaa7Module {}
